how to start SOAP connection via DXL

Hi,

I wanted to know the method of starting the SOAP connection using DXL.
I need to transfer content to a https server, due to some reasons I can not use IPC for transferring data.
If someone has a sample program where i can get idea for starting a SOAP connection would be a great help.

With Regards,
Ashish
DXLNeed - Mon Aug 17 00:51:25 EDT 2009

Re: how to start SOAP connection via DXL
SSloan - Thu Sep 03 16:40:56 EDT 2009

I have been considering this question myself. My plan is to write a SOAP client in Python and then expose it via OLE. I don't have any sample code though (yet). :-)

Re: how to start SOAP connection via DXL
TapasMondal - Wed Aug 29 02:20:20 EDT 2012

SSloan - Thu Sep 03 16:40:56 EDT 2009
I have been considering this question myself. My plan is to write a SOAP client in Python and then expose it via OLE. I don't have any sample code though (yet). :-)

Did you get any solution?
Please help me

Re: how to start SOAP connection via DXL
Mathias Mamsch - Wed Aug 29 03:44:09 EDT 2012

TapasMondal - Wed Aug 29 02:20:20 EDT 2012
Did you get any solution?
Please help me

You can use the Microsoft XMLHttpRequest OLE object to send and retrieve the data.

See the reference here: http://msdn.microsoft.com/en-us/library/ie/ms535874(v=vs.85).aspx

The Soap Reference will give you the right content for your requests:
http://www.w3schools.com/soap/default.asp

It should be pretty straight forward to implement. If you have more questions, feel free to ask. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: how to start SOAP connection via DXL
TapasMondal - Thu Aug 30 03:14:06 EDT 2012

Mathias Mamsch - Wed Aug 29 03:44:09 EDT 2012
You can use the Microsoft XMLHttpRequest OLE object to send and retrieve the data.

See the reference here: http://msdn.microsoft.com/en-us/library/ie/ms535874(v=vs.85).aspx

The Soap Reference will give you the right content for your requests:
http://www.w3schools.com/soap/default.asp

It should be pretty straight forward to implement. If you have more questions, feel free to ask. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Thank you for your reply.

I want to send data to my WCF Service after updating a data requirement.
I have written a trigger for this.And I am getting event from trigger when it is updated.

After that I want to send this data from DXL to WCF.

Please help. I am in stuck

Re: how to start SOAP connection via DXL
Mathias Mamsch - Thu Aug 30 08:17:53 EDT 2012

TapasMondal - Thu Aug 30 03:14:06 EDT 2012
Thank you for your reply.

I want to send data to my WCF Service after updating a data requirement.
I have written a trigger for this.And I am getting event from trigger when it is updated.

After that I want to send this data from DXL to WCF.

Please help. I am in stuck

Well it is unlikely that someone will jump in and code that for you (except someone already did that). You need to tell us where you are stuck. Is it that you do not know how to use COM Objects in Doors (e.g. MSXmlHttp)? Is it that you do not know SOAP, so you do not know what to send? Do you not have enough general experience in DXL? Do you have something to start with? Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: how to start SOAP connection via DXL
TapasMondal - Fri Aug 31 00:01:15 EDT 2012

Mathias Mamsch - Thu Aug 30 08:17:53 EDT 2012
Well it is unlikely that someone will jump in and code that for you (except someone already did that). You need to tell us where you are stuck. Is it that you do not know how to use COM Objects in Doors (e.g. MSXmlHttp)? Is it that you do not know SOAP, so you do not know what to send? Do you not have enough general experience in DXL? Do you have something to start with? Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Thanks for your reply.

I am really sorry to say that I am very new to DXL. I don't know how to use com object in DXL
Please help

Re: how to start SOAP connection via DXL
Mathias Mamsch - Fri Aug 31 03:33:00 EDT 2012

TapasMondal - Fri Aug 31 00:01:15 EDT 2012
Thanks for your reply.

I am really sorry to say that I am very new to DXL. I don't know how to use com object in DXL
Please help

Well in this case I would suggest that you start out sketching the necessary code in another language, that you are familiar with, e.g. VB/VBA. There are lots of examples for XMLHttp and Soap out there. See for example here (google for 'createObject soap xmlhttp':

http://msdn.microsoft.com/en-us/library/windows/desktop/aa813645%28v=vs.85%29.aspx

Once your code works, then translating to DXL is pretty straight forward. If you use some OLE helper function, e.g. from this post:

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=453050&tstart=0

then the VB code in the above example is quickly translated to DXL (*Note that code only shall show how easy it is to translate from VB to DXL,it is not a working example*):
 

// VBA Code
 
/*
    set xmlhttp = CreateObject("Msxml2.XMLHTTP")
    xmlhttp.open "POST", "http://localhost/dsmlsoap/adssoap.dsmlx", false
    xmlhttp.setRequestHeader "SOAPAction", """#batchRequest"""
    xmlhttp.send myMessage
    sResult = xmlhttp.responsetext
*/ 
 
// translated to DXL: 
 
OleAutoObj xmlhttp = oleCreateAutoObj "MSXML2.XMLHTTP"
checkNull oleMethod (xmlhttp, "Open", createArgs() <- "POST" <- "http://localhost/dsmlsoap/adssoap.dsmlx" <- false)
checkNull oleMethod (xmlhttp, "setRequestHeader", createArgs() <- "SOAPAction" <- "\"#batchRequest\"")
checkNull oleMethod (xmlhttp, "send", myMessage)
string sResult = "" 
checkNull oleGet (xmlhttp, "ResponseText")

 


Hope that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: how to start SOAP connection via DXL
TapasMondal - Wed Sep 12 07:38:43 EDT 2012

Mathias Mamsch - Fri Aug 31 03:33:00 EDT 2012

Well in this case I would suggest that you start out sketching the necessary code in another language, that you are familiar with, e.g. VB/VBA. There are lots of examples for XMLHttp and Soap out there. See for example here (google for 'createObject soap xmlhttp':

http://msdn.microsoft.com/en-us/library/windows/desktop/aa813645%28v=vs.85%29.aspx

Once your code works, then translating to DXL is pretty straight forward. If you use some OLE helper function, e.g. from this post:

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=453050&tstart=0

then the VB code in the above example is quickly translated to DXL (*Note that code only shall show how easy it is to translate from VB to DXL,it is not a working example*):
 

// VBA Code
 
/*
    set xmlhttp = CreateObject("Msxml2.XMLHTTP")
    xmlhttp.open "POST", "http://localhost/dsmlsoap/adssoap.dsmlx", false
    xmlhttp.setRequestHeader "SOAPAction", """#batchRequest"""
    xmlhttp.send myMessage
    sResult = xmlhttp.responsetext
*/ 
 
// translated to DXL: 
 
OleAutoObj xmlhttp = oleCreateAutoObj "MSXML2.XMLHTTP"
checkNull oleMethod (xmlhttp, "Open", createArgs() <- "POST" <- "http://localhost/dsmlsoap/adssoap.dsmlx" <- false)
checkNull oleMethod (xmlhttp, "setRequestHeader", createArgs() <- "SOAPAction" <- "\"#batchRequest\"")
checkNull oleMethod (xmlhttp, "send", myMessage)
string sResult = "" 
checkNull oleGet (xmlhttp, "ResponseText")

 


Hope that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Thank you for your response.

I am able to write VBS and successfully run this script.
But When I convert to DXL did not find any error or any response.
But I can see call log in IIS for DXL and VBS.

I am attaching .vbs file and following is the dxl code
string URL = "http://localhost/TestService/WebService.asmx"
string nsUrl = "http://tempuri.org/"
please help.
string GenerateSoapBodyStart()
{
string strSoap
strSoap = "<?xml version=""1.0"" encoding=""utf-8""?>"
strSoap = strSoap "<soapenv:Envelope "
strSoap = strSoap "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" "
strSoap = strSoap "xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "
strSoap = strSoap "xmlns:soapenv=""http://www.w3.org/2003/05/soap-envelope""> "
strSoap = strSoap "<soapenv:Body>"
return (strSoap)

}
string GenerateSoapBodyEnd()
{
string strSoap
strSoap = "</soapenv:Body>"
strSoap = strSoap "</soapenv:Envelope>"
return (strSoap)

}

string GenerateSoapFunctionCallStart(string strFunction)
{
string strSoap
strSoap = "<" xmlns=""" nsUrl """>"
return ( strSoap)

}
string GenerateSoapFunctionCallEnd(string strFunction)
{
string strSoap
strSoap = "</">"
return( strSoap)

}
string GenerateSoapParameter(string strParam, string strValue)
{
string strSoap
strSoap = "<">"
strSoap = strSoap strValue
strSoap = strSoap "</">"
return ( strSoap)

}

string strSoapReq
strSoapReq = GenerateSoapBodyStart()
strSoapReq = strSoapReq GenerateSoapFunctionCallStart("HelloWorld")

strSoapReq = strSoapReq GenerateSoapParameter("input", "This is Tapas")
strSoapReq = strSoapReq GenerateSoapFunctionCallEnd("HelloWorld")
strSoapReq = strSoapReq GenerateSoapBodyEnd()
print strSoapReq

OleAutoObj xmlhttp = oleCreateAutoObject "MSXML2.XMLHTTP"

OleAutoArgs autoArgs = create

put(autoArgs, "post")
put(autoArgs, URL)
put(autoArgs, "false")

print "\nsssssssssss\n"
print oleMethod (xmlhttp,"open", autoArgs )
print "\nssssssss\n"
OleAutoArgs autoArgs1 = create
put(autoArgs1, "Content-Type")
put(autoArgs1, "text/xml")
print oleMethod (xmlhttp, "setRequestHeader",autoArgs1 )
autoArgs1 = create
put(autoArgs1, "SOAPAction")
put(autoArgs1, "\"http://tempuri.org/HelloWorld\"")

print oleMethod (xmlhttp, "setRequestHeader",autoArgs1 )
print "\nsetRequestHeader\n"
OleAutoArgs autoArgs2 = create
put(autoArgs2 ,strSoapReq);
string sResult = ""
print oleMethod (xmlhttp, "send",autoArgs2 )
print "\nsend\n"

print "\n" sResult

oleGet(xmlhttp, "readyState",sResult )
//print oleGet(xmlhttp, "POST",sResult )
print "\n" sResult
Attachments

attachment_14885875_ws-sample.vbs

Re: how to start SOAP connection via DXL
Mathias Mamsch - Wed Sep 12 09:19:17 EDT 2012

TapasMondal - Wed Sep 12 07:38:43 EDT 2012
Thank you for your response.

I am able to write VBS and successfully run this script.
But When I convert to DXL did not find any error or any response.
But I can see call log in IIS for DXL and VBS.

I am attaching .vbs file and following is the dxl code
string URL = "http://localhost/TestService/WebService.asmx"
string nsUrl = "http://tempuri.org/"
please help.
string GenerateSoapBodyStart()
{
string strSoap
strSoap = "<?xml version=""1.0"" encoding=""utf-8""?>"
strSoap = strSoap "<soapenv:Envelope "
strSoap = strSoap "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" "
strSoap = strSoap "xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "
strSoap = strSoap "xmlns:soapenv=""http://www.w3.org/2003/05/soap-envelope""> "
strSoap = strSoap "<soapenv:Body>"
return (strSoap)

}
string GenerateSoapBodyEnd()
{
string strSoap
strSoap = "</soapenv:Body>"
strSoap = strSoap "</soapenv:Envelope>"
return (strSoap)

}

string GenerateSoapFunctionCallStart(string strFunction)
{
string strSoap
strSoap = "<" xmlns=""" nsUrl """>"
return ( strSoap)

}
string GenerateSoapFunctionCallEnd(string strFunction)
{
string strSoap
strSoap = "</">"
return( strSoap)

}
string GenerateSoapParameter(string strParam, string strValue)
{
string strSoap
strSoap = "<">"
strSoap = strSoap strValue
strSoap = strSoap "</">"
return ( strSoap)

}

string strSoapReq
strSoapReq = GenerateSoapBodyStart()
strSoapReq = strSoapReq GenerateSoapFunctionCallStart("HelloWorld")

strSoapReq = strSoapReq GenerateSoapParameter("input", "This is Tapas")
strSoapReq = strSoapReq GenerateSoapFunctionCallEnd("HelloWorld")
strSoapReq = strSoapReq GenerateSoapBodyEnd()
print strSoapReq

OleAutoObj xmlhttp = oleCreateAutoObject "MSXML2.XMLHTTP"

OleAutoArgs autoArgs = create

put(autoArgs, "post")
put(autoArgs, URL)
put(autoArgs, "false")

print "\nsssssssssss\n"
print oleMethod (xmlhttp,"open", autoArgs )
print "\nssssssss\n"
OleAutoArgs autoArgs1 = create
put(autoArgs1, "Content-Type")
put(autoArgs1, "text/xml")
print oleMethod (xmlhttp, "setRequestHeader",autoArgs1 )
autoArgs1 = create
put(autoArgs1, "SOAPAction")
put(autoArgs1, "\"http://tempuri.org/HelloWorld\"")

print oleMethod (xmlhttp, "setRequestHeader",autoArgs1 )
print "\nsetRequestHeader\n"
OleAutoArgs autoArgs2 = create
put(autoArgs2 ,strSoapReq);
string sResult = ""
print oleMethod (xmlhttp, "send",autoArgs2 )
print "\nsend\n"

print "\n" sResult

oleGet(xmlhttp, "readyState",sResult )
//print oleGet(xmlhttp, "POST",sResult )
print "\n" sResult

You seem to have forgotten to query the responseText in the DXL code. Was this wanted?
 

string sResult = "" 
print oleMethod (xmlhttp, "send",autoArgs2 )
 
print "\nsend\n"
 
// before you queried readyState? Was this just some debug code?
print oleGet(xmlhttp, "responseText",sResult ) 
 
print "\n" sResult

 


Maybe this helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: how to start SOAP connection via DXL
Mathias Mamsch - Wed Sep 12 09:22:12 EDT 2012

TapasMondal - Wed Sep 12 07:38:43 EDT 2012
Thank you for your response.

I am able to write VBS and successfully run this script.
But When I convert to DXL did not find any error or any response.
But I can see call log in IIS for DXL and VBS.

I am attaching .vbs file and following is the dxl code
string URL = "http://localhost/TestService/WebService.asmx"
string nsUrl = "http://tempuri.org/"
please help.
string GenerateSoapBodyStart()
{
string strSoap
strSoap = "<?xml version=""1.0"" encoding=""utf-8""?>"
strSoap = strSoap "<soapenv:Envelope "
strSoap = strSoap "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" "
strSoap = strSoap "xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "
strSoap = strSoap "xmlns:soapenv=""http://www.w3.org/2003/05/soap-envelope""> "
strSoap = strSoap "<soapenv:Body>"
return (strSoap)

}
string GenerateSoapBodyEnd()
{
string strSoap
strSoap = "</soapenv:Body>"
strSoap = strSoap "</soapenv:Envelope>"
return (strSoap)

}

string GenerateSoapFunctionCallStart(string strFunction)
{
string strSoap
strSoap = "<" xmlns=""" nsUrl """>"
return ( strSoap)

}
string GenerateSoapFunctionCallEnd(string strFunction)
{
string strSoap
strSoap = "</">"
return( strSoap)

}
string GenerateSoapParameter(string strParam, string strValue)
{
string strSoap
strSoap = "<">"
strSoap = strSoap strValue
strSoap = strSoap "</">"
return ( strSoap)

}

string strSoapReq
strSoapReq = GenerateSoapBodyStart()
strSoapReq = strSoapReq GenerateSoapFunctionCallStart("HelloWorld")

strSoapReq = strSoapReq GenerateSoapParameter("input", "This is Tapas")
strSoapReq = strSoapReq GenerateSoapFunctionCallEnd("HelloWorld")
strSoapReq = strSoapReq GenerateSoapBodyEnd()
print strSoapReq

OleAutoObj xmlhttp = oleCreateAutoObject "MSXML2.XMLHTTP"

OleAutoArgs autoArgs = create

put(autoArgs, "post")
put(autoArgs, URL)
put(autoArgs, "false")

print "\nsssssssssss\n"
print oleMethod (xmlhttp,"open", autoArgs )
print "\nssssssss\n"
OleAutoArgs autoArgs1 = create
put(autoArgs1, "Content-Type")
put(autoArgs1, "text/xml")
print oleMethod (xmlhttp, "setRequestHeader",autoArgs1 )
autoArgs1 = create
put(autoArgs1, "SOAPAction")
put(autoArgs1, "\"http://tempuri.org/HelloWorld\"")

print oleMethod (xmlhttp, "setRequestHeader",autoArgs1 )
print "\nsetRequestHeader\n"
OleAutoArgs autoArgs2 = create
put(autoArgs2 ,strSoapReq);
string sResult = ""
print oleMethod (xmlhttp, "send",autoArgs2 )
print "\nsend\n"

print "\n" sResult

oleGet(xmlhttp, "readyState",sResult )
//print oleGet(xmlhttp, "POST",sResult )
print "\n" sResult

Aah... You are escaping the DXL strings wrong. In VBA to insert a double-quote in a string you do: """in Quotes""". In DXL you need to do: "\"in Quotes\"". So the messages you are sending are not valid. Check your DXL strings and escape backslashes and double-quotes correctly. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: how to start SOAP connection via DXL
TapasMondal - Wed Sep 12 09:36:28 EDT 2012

Mathias Mamsch - Wed Sep 12 09:22:12 EDT 2012
Aah... You are escaping the DXL strings wrong. In VBA to insert a double-quote in a string you do: """in Quotes""". In DXL you need to do: "\"in Quotes\"". So the messages you are sending are not valid. Check your DXL strings and escape backslashes and double-quotes correctly. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Thanks the problem was with Quote.

Now it is working well....

Thank you again. I spent half day for this silly mistake.

With Regards,

Tapas